#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct pt{
    int x = -1;
    int y = -1;
}p1, p2;
int main() {
    int n, m;
    cin >> n >> m;
    vector<string> board(n);
    vector<vector<int>> pos = {{1,0},{-1,0},{0,1},{0,-1}};
    for(int i = 0; i < n; ++i) {
        cin >> board[i];
    }
    vector<vector<int>> cixu(n, vector<int>(m, -1));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < m; ++j) {
            if(board[i][j] == '+') {
                if(p1.x != -1) {
                    p2.x = i, p2.y = j;
                }else {
                    p1.x = i, p1.y = j;
                }
            }
        }
    }
    int x = p1.x, y = p1.y;
    int step = 1;
    queue<int> q;
    for(int i = 0; i < 4; ++i) {
        int nx = x + pos[i][0];
        int ny = y + pos[i][1];
        if(0 <= nx && nx < n && 0 <= ny && ny < m && cixu[nx][ny] == -1) {
           cixu[nx][ny] = step; 
        }
    }
    for(; x >= 0 && x < n && y >= 0 && y < m; ) {
        x 
    }
    
}